<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>{block name="title"}网站标题{/block}</title>
    <link rel="stylesheet" href="/static/layui/src/css/layui.css">
    {block name="style"}{/block}
  </head>
  <body class="layui-layout-body">
    <div class="layui-layout layui-layout-admin">
      <div id="LAY_app" class="layadmin-tabspage-none layadmin-side-spread-sm">
      <div class="layui-header">
        <div class="layui-logo" style="background-color: #009688">
          <a href="{:url('index/index')}" style="color: rgba(255,255,255)">
            后台管理
          </a>
        </div>
          <ul class="layui-nav layui-layout-left">
          
          <li class="layui-nav-item"><a href="/admin/out/index">提币待审核（<span style="color: red;font-size: 15px" id='a1'>0</span>）</a></li>
          <li class="layui-nav-item"><a href="/admin/out/index">单笔提币超100u（<span style="color: red;font-size: 15px" id='a2'>0</span>）</a></li>
          <li class="layui-nav-item"><a href="/admin/out/index">近7天3次提币（<span style="color: red;font-size: 15px" id='a3'>0</span>）</a></li>
          <li class="layui-nav-item"><a href="/admin/out/index">单笔提币超40%（<span style="color: red;font-size: 15px" id='a4'>0</span>）</a></li>
          <li class="layui-nav-item"><a href="#">近30秒有新充值（<span style="color: red;font-size: 15px" id='a5'>0</span>）</a></li>
        </ul>
        <div>
        <ul class="layui-nav layui-layout-left">
          <li class="layui-nav-item layadmin-flexible" lay-unselect="">
            <a href="javascript:;" layadmin-event="flexible" title="侧边伸缩" class="kit-side-fold">
              <!-- <i class="layui-icon layui-icon-spread-left" id="LAY_app_flexible"></i> -->
            </a>
          </li>
        </ul>
        <ul class="layui-nav layui-layout-right">
          <li class="layui-nav-item">
            <a href="javascript:;">
              <img src="{$user_info.pic}" class="layui-nav-img">
              {$user_info.name ?? ''}
            </a>
            <dl class="layui-nav-child">
              <dd><a href="{:url('admin/edit')}">基本资料</a></dd>
            </dl>
          </li>
          <li class="layui-nav-item"><a href="{:url('login/logout')}">退出</a></li>
        </ul>
      </div>
      </div>
       <audio id="feedback"><source src="/static/mp3/feedback.mp3" type="audio/ogg"></audio>
      <div class="layui-side layui-bg-black">
        <div class="layui-side-scroll">

          <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
          <ul class="layui-nav layui-nav-tree"  lay-filter="test">
            {foreach $nav as $vo} 
               <li class="layui-nav-item" id="{$vo.id}">
                <a class="layui-nav-title" href="javascript:;">{$vo.title}</a>
                <dl class="layui-nav-child">
                  {foreach $vo.nav_list as $v} 
                    <dd id="{$v.id}"><a href="{:url($v.controller.'/'.$v.action)}">{$v.title}</a></dd>
                  {/foreach}
                </dl>
              </li> 
            {/foreach}
          </ul>
        </div>
      </div>
      <div class="layui-body">
        <!-- 内容主体区域 -->
        <div style="padding: 10px;" id='content'>
          {block name="content"}主内容{/block}
        </div>
      </div>
      <div class="layui-footer footer footer-demo">
        <!-- 底部固定区域 -->
        <div class="layui-main">
          <p>© 2021 MAKE BY author</p>
        </div>
      </div>
    </div>
    </div>
    <script src="/static/layui/src/layui.js"></script>
    <script src="/static/js/jquery.min.js"></script>
    <script>
    //JavaScript代码区域
    layui.use(['element','form'], function(){
      var element = layui.element;
      var form = layui.form; 
      form.render();
    });
     var isShow = true; //定义一个标志位
  $('.kit-side-fold').click(function(){
    //选择出所有的span，并判断是不是hidden
    // alert(1);
    $('.layui-nav-item span').each(function(){
      if($(this).is(':hidden')){
        $(this).show();
      }else{
        $(this).hide();
      }
    });
    //判断isshow的状态
    if(isShow){
      $('.layui-side.layui-bg-black').width(0); //设置宽度
      $('.kit-side-fold i').css('margin-right', '70%'); //修改图标的位置
      //将footer和body的宽度修改
      $('.layui-body').css('left', 0+'px');
      $('.layui-footer').css('left', 0+'px');
      //将二级导航栏隐藏
      $('dd span').each(function(){
        $(this).hide();
      });
      //修改标志位
      isShow =false;
    }else{
      $('.layui-side.layui-bg-black').width(200);
      $('.kit-side-fold i').css('margin-right', '10%');
      $('.layui-body').css('left', 200+'px');
      $('.layui-footer').css('left', 200+'px');
      $('dd span').each(function(){
        $(this).show();
      });
      isShow =true;
    }
  });
    $(function(){
      var nav_id   = "{$nav_id.id}";
      var nav_pid  = "{$nav_id.pid}";
      if (nav_id != 0) {
        $("dd#"+nav_id).attr('class','layui-this');
        $("li#"+nav_pid).attr('class','layui-nav-item layui-nav-itemed');

        var bl = $("#LAY_app_flexible").hasClass("layui-icon-shrink-right");
            if (bl) {
                $("#LAY_app_flexible").click();
            }
      }
      // var audio = document.getElementById('feedback');
      // audio.play();
       $.ajax({
            url:'/admin/index/newMessage',
            type:'GET',
            success:function(ret){
              if (ret.code == 0) {
                // var audio = document.getElementById('feedback');
                // audio.play(); //播放 mp3这个音频对象
                // alert(ret.msg);
                //暂停
                $('#a1').html(ret.data.a1)
                $('#a2').html(ret.data.a2)
                $('#a3').html(ret.data.a3)
                $('#a4').html(ret.data.a4)
                $('#a5').html(ret.data.a5)
              }
            }
          });
        var a = setInterval(function() {
            $.ajax({
            url:'/admin/index/newMessage',
            type:'GET',
            success:function(ret){
              if (ret.code == 0) {
                // var audio = document.getElementById('feedback');
                // audio.play(); //播放 mp3这个音频对象
                // alert(ret.msg);
                //暂停
                 // mp3.pause();
                 $('#a1').html(ret.data.a1)
                $('#a2').html(ret.data.a2)
                $('#a3').html(ret.data.a3)
                $('#a4').html(ret.data.a4)
                $('#a5').html(ret.data.a5)
              }
            }
          });
        }, 15000);
      });

 
    
    </script>
    {block name="script"}js{/block}
  </body>
</html>